Expose ImportAdder to IPC API - #3881
Merged
Merged
Conversation
navya9singh
approved these changes
Jun 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the native-preview IPC API to expose ImportAdder-based auto-import edit computation to clients, including logic to ensure the auto-import registry is prepared for the target file and tests validating the new behavior.
Changes:
- Added a new IPC method
getImportAdderEdits(Go server) that computes/coalesces import edits viaautoimport.ImportAdder, preparing auto-import data on-demand. - Added
Session.GetSnapshotWithAutoImports(Go project session) to clone/adopt an auto-import-prepared snapshot without flushing pending file changes, plus a regression test for snapshot adoption. - Added native-preview async/sync client APIs + types and tests to request and apply returned
TextEdit[]results.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/project/snapshot_test.go | Adds a snapshot regression test asserting auto-import-prepared snapshots are adopted when unchanged. |
| internal/project/session.go | Introduces GetSnapshotWithAutoImports and refactors auto-import snapshot cloning/adoption. |
| internal/api/session.go | Adds handleGetImportAdderEdits server handler to compute ImportAdder edits from symbol actions. |
| internal/api/proto.go | Adds protocol method/params for getImportAdderEdits and a TextEdit payload type. |
| _packages/native-preview/test/sync/api.test.ts | Adds sync client tests for import edit computation and action validation. |
| _packages/native-preview/test/async/api.test.ts | Adds async client tests for import edit computation and action validation. |
| _packages/native-preview/src/api/sync/types.ts | Adds ImportAdderAction / options types in the sync surface area. |
| _packages/native-preview/src/api/sync/api.ts | Adds sync Project.getImportAdderEdits and convenience wrapper. |
| _packages/native-preview/src/api/proto.ts | Adds TextEdit + ImportAdderActionRequest protocol request types. |
| _packages/native-preview/src/api/async/types.ts | Adds ImportAdderAction / options types in the async surface area. |
| _packages/native-preview/src/api/async/api.ts | Adds async Project.getImportAdderEdits and convenience wrapper. |
andrewbranch
force-pushed
the
api-import-adder
branch
from
July 10, 2026 16:36
19415f3 to
963fd6d
Compare
Comment on lines
+1163
to
1165
| if callerRef { | ||
| newSnapshot.ref() | ||
| } |
Member
Author
There was a problem hiding this comment.
This is ok because it's a fresh clone that nobody else could have gotten access to yet.
gabritto
reviewed
Jul 10, 2026
gabritto
reviewed
Jul 10, 2026
gabritto
reviewed
Jul 10, 2026
gabritto
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.